<?xml version="1.0" encoding="utf-8" ?>
[#include "/WEB-INF/pages/common/taglibs.ftl"]
[@c.url var="backUrl" value="/manage/Member_list.action" scope="page"][/@c.url]
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Insert title here</title>
		<meta name="menu" content="CategoryMenu"/> 
		<meta name="heading" content="heading"/>
		<link rel="stylesheet" href="[@c.url value='/style/plugins/chosen.css'/]" type="text/css" />
		<script type="text/javascript" src="[@c.url value='/js/plugins/chosen.jquery.min.js'/]"></script>
		<script type="text/javascript" src="[@c.url value='/dwr/engine.js'/]"></script>
  		<script type="text/javascript" src="[@c.url value='/dwr/interface/userService.js'/]"></script>
		[#--<script type="text/javascript" src="[@c.url value='/dwr/util.js'/]"></script>--]
		<script type="text/javascript">
			var base = (function(){
				// 事件绑定
				function _addEventListeners() {
					//初始化选项
					//$('select[key="single"]').val("");
					
					$('select[key="single"]').change(function(){
						var username = $(this).val();
						if (username == null || username == "") {
							$('input[name*="member.user"]', '#memberForm').each(function(){
								$(this).val('');
							})
							return true;
						}
						userService._find(username, {
							callback: function(data) {
								$('input[name*="user"]', '#memberForm').each(function(){
									var name = $(this).attr('name').replace("member.user.","");
									$(this).val(data[name]);
								})
								$("input:hidden[name='member.userId']").val(data['id']);
							}, exceptionHandler: function(message) {
  								alert("异常：" + message);
  							}
  						});
					})
				}
				return {
	                config: {
	                	url : null,
	                    theme: null
	                },
	                init: function () {
	                	_addEventListeners();
	                	// 初始化select
	                	common_choose.init();
	                }
				}
			}());
			
			$(function(){
				var link = "[@c.url value='/manage/User_list.action?currentPage=${currentPage}' /]";
				base.config.theme = getTheme();
				base.config.url = link;
	            //Initializing the form
				base.init();
			})
		</script>
	</head>
	<body id="body">
		<!--设置提交行为
		<div class="contenttitle">
	    	<h2 id="vertical" class="form"><span>会员信息</span></h2>
	    </div>--><!--contenttitle-->
		[#assign act="save" /]
		[#include "/WEB-INF/pages/manage/Member/_member.ftl"]
	</body>
</html>